<?php

class ZFKiller_Form_Element extends Zend_Form_Element {

	/**
	 * Adiciona um valor ao Attrib
	 *
	 * @param Zend_Form_Element $element
	 * @param string $name
	 * @param string $value
	 * @param string $separator
	 * @param string $pos A posição. Pode ser APPEND ou PREPEND
	 */
	public static function addAttrib(Zend_Form_Element & $element, $name, $value, $separator = ' ', $pos = 'APPEND') {
		$valueAttrib = $element->getAttrib($name);
		if (!is_null($valueAttrib)) {
			$value = $valueAttrib . $separator . $value;
		}
		$element->setAttrib($name, $value);
		return $element;
	}

	public static function formatDefaultOptions(& $spec, & $options = null) {
		if (is_string($options)) {
			$options = array('label' => $options);
		}
	}

	public static function formatElementAsDate(ZFKiller_Form_Element_Date & $element) {
		$element->setAttrib('size', 10)
				->setAttrib('maxlength', 10)
				->setDescription('(Formato: ' . Zend_Locale_Format::getDateFormat() . ')')
				->addValidator('Date');
	}

	public static function formatElementAsText($element) {
		
	}

}
